<template>
  <div class="conMain" >
    <el-card  class="box-card" >
      <div slot="header" class="topfix">
      </div>
      <el-table v-loading="loading"  :data="list" style="width: 100%" :empty-text='emtypetxt'>
          <el-table-column prop="id" label="ID" align="center"/>
          <el-table-column prop="title" label="协议标题" align="center"  />
          <el-table-column prop="createtime" label="创建时间" align="center"  />
          <el-table-column prop="updatetime" label="更新时间" align="center"  />
          <el-table-column label="操作" align="center" >
            <template slot-scope="scope" >

                <el-link v-has="'cms/agree/edit'" :underline="false" type="primary" title='编辑' @click="edit(scope.row.id)">编辑</el-link>

            </template>
          </el-table-column>
      </el-table>
    </el-card>


  </div>
</template>

<script>

import { agree_index,agree_edit_post } from  '@/api/cms'

export default {
  data() {
    return {

      loading:true,
      emtypetxt:'',
      list: [],
      params: {
        page: 1,
        pagesize:100,
      },


    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.emtypetxt='加载中...';
      this.loading=true;
      agree_index(this.params).then(res => {
        this.list=res.data.list
        this.total=res.data.total
        this.loading = false
        if(this.list.length==0){
          this.emtypetxt='暂无数据'
        }
      })
    },
    //编辑
    edit(id){
      this.$router.push('/cms/agree_edit?id='+id)
    },
    //数据提交
    subForm(formName) {
        this.$refs[formName].validate((valid) => {
            if (valid) {
                agree_edit_post(this.sub).then(res => {
                    this.$message.success(res.msg);
                    this.dialogVisible = false
                    this.getList()
                })
            } else {
              return false;
            }
        });
    },
    // 取消
    handleCalcel() {
      this.dialogVisible = false
    },
  },
}
</script>

<style lang="scss" scoped>


</style>
